﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ImportFamilyInfo.aspx.cs" Inherits="Family_ImportFamilyInfo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>管理家庭信息</title>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            font-size: x-large;
            text-align: center;
            background-color: #CCCCCC;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <table cellpadding="0" cellspacing="0" class="style1">
            <tr>
                <td class="style2">
                    <strong>管理家庭信息</strong></td>
            </tr>
            <tr>
                <td style="text-align: right">
                 <a href="ConfirmBookArrived.aspx" style="text-align: right">跳转到图书确认页</a>
                    </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    年级<asp:DropDownList 
                        ID="grade" runat="server" 
                        AutoPostBack="True" DataSourceID="gradedata" DataTextField="Gname" 
                        DataValueField="GID" ondatabound="grade_DataBound">
                    </asp:DropDownList>
&nbsp; 班级<asp:DropDownList ID="bj" runat="server" AutoPostBack="True" DataSourceID="bjdata" 
                        DataTextField="Cname" DataValueField="CID" ondatabound="bj_DataBound">
                    </asp:DropDownList>
&nbsp; 姓名<asp:TextBox ID="studentName" runat="server" Font-Size="14pt" MaxLength="10"></asp:TextBox>
&nbsp;<asp:Button ID="Button1" runat="server" Text="查询" />
                </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    <asp:SqlDataSource ID="gradedata" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:DataConn %>" 
                        SelectCommand="SELECT [GID], [Gname] FROM [Grade] ORDER BY [GID]"></asp:SqlDataSource>
                    <asp:SqlDataSource ID="bjdata" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:DataConn %>" 
                        SelectCommand="SELECT [CID], [Cname] FROM [Class] ORDER BY [CID]">
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp; 家庭信息Excel文件<asp:FileUpload ID="fu" runat="server" />
&nbsp;<asp:Button ID="Button2" runat="server" Text="导入" OnClientClick="return confirm('导入家庭信息吗？')" 
                        onclick="Button2_Click" />
                </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    数据记录<asp:Label ID="msg" runat="server" Font-Bold="True" ForeColor="#FF3300"></asp:Label>
                    条</td>
            </tr>
            <tr>
                <td>
                    <asp:GridView ID="gv" runat="server" CellPadding="4" ForeColor="#333333" 
                        GridLines="None" Width="100%" AllowPaging="True" AllowSorting="True" 
                        DataKeyNames="id" DataSourceID="gvdata" PageSize="20" 
                        AutoGenerateColumns="False">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <Columns>
                            <asp:BoundField DataField="ID" HeaderText="流水号" InsertVisible="False" 
                                ReadOnly="True" SortExpression="ID" />
                            <asp:BoundField DataField="Sname" HeaderText="学生姓名" SortExpression="Sname" />
                            <asp:BoundField DataField="RXNF" HeaderText="入学年份" SortExpression="RXNF" />
                            <asp:BoundField DataField="CID" HeaderText="班级编号" SortExpression="CID" />
                            <asp:BoundField DataField="Sex" HeaderText="性别" SortExpression="Sex" />
                            <asp:BoundField DataField="Fname" HeaderText="父母姓名" SortExpression="Fname" />
                            <asp:BoundField DataField="Mobile" HeaderText="手机"  
                                SortExpression="Mobile" />
                            <asp:BoundField DataField="PWD" HeaderText="密码" SortExpression="PWD" />
                            <asp:BoundField DataField="Flag" HeaderText="登录标志" SortExpression="Flag" />
                            <asp:BoundField DataField="IsTeacher" HeaderText="是否教师" 
                                SortExpression="IsTeacher" />
                            <asp:CommandField ButtonType="Button" ShowEditButton="True" />
                            <asp:TemplateField ShowHeader="False">
                                <ItemTemplate>
                                    <asp:Button ID="Button1" runat="server" CausesValidation="False" OnClientClick="return confirm('删除当前家庭吗？')"
                                        CommandName="Delete" Text="删除此条" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#999999" />
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <PagerSettings Position="Top" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:SqlDataSource ID="gvdata" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:DataConn %>" 
                        onselected="gvdata_Selected" SelectCommand="Search_Family_From_Grade_BJ_Name" 
                        SelectCommandType="StoredProcedure" 
                        DeleteCommand="delete from family where id=@id" 
                        UpdateCommand="update familyinfo set sname=@sname,rxnf=@rxnf,cid=@cid,sex=@sex,fname=@fname,mobile=@mobile,pwd=@pwd,flag=@flag,isteacher=@isteacher where id=@id">
                        <DeleteParameters>
                            <asp:Parameter Name="id" />
                        </DeleteParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="grade" Name="grade" 
                                PropertyName="SelectedValue" Type="Int32" />
                            <asp:ControlParameter ControlID="bj" Name="BJ" PropertyName="SelectedValue" 
                                Type="Int32" />
                            <asp:ControlParameter ControlID="studentName" ConvertEmptyStringToNull="False" 
                                Name="StudentName" PropertyName="Text" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
        </table>
    
    </div>
    </form>
</body>
</html>
